perm filename DIGITZ.MF[MF,DEK]1 blob
sn#754235 filedate 1984-05-11 generic text, type T, neo UTF8
% this is the file used in the lecture about digitizing, on May 11
% the first few lines are a simple base file for this demo
delimiters (); % ( and ) are matching delimiters
proofing:=1; % output file for hardcopy will be generated
openwindow 0 from (0,0) to (200,500) at (-40,100);
edges e; % digitized edges will go into variable e
def makechar(expr p) =
e:=nulledges; addto e contour p; display e on 0; shipout e enddef;
def shiftedright expr x = shifted (x,0) enddef;
tracingonline:=1; % diagnostics will be shown on the terminal
pausing:=1; % the next lines will be visible on the terminal
tracingedges:=1; % MF will now show all the edges it digitizes
path p; p=(-20,-50)..(-20,50) & (-20,50)..(0,0)..(-20,-50) & cycle;
makechar(p);
% at this point the following output shows how path p is digitized:
% Tracing edges at line 15: (weight -1)
% (-20,-50)(-20,50)(-20,49)(-19,49)(-19,48)(-18,48)(-18,47)(-17,47)(-17,46)
% (-16,46)(-16,45)(-15,45)(-15,44)(-14,44)(-14,42)(-13,42)(-13,41)(-12,41)
% (-12,39)(-11,39)(-11,38)(-10,38)(-10,36)(-9,36)(-9,34)(-8,34)(-8,32)
% (-7,32)(-7,30)(-6,30)(-6,28)(-5,28)(-5,25)(-4,25)(-4,22)(-3,22)(-3,19)
% (-2,19)(-2,15)(-1,15)(-1,9)(0,9)(0,-9)(-1,-9)(-1,-15)(-2,-15)(-2,-19)
% (-3,-19)(-3,-22)(-4,-22)(-4,-25)(-5,-25)(-5,-28)(-6,-28)(-6,-30)(-7,-30)
% (-7,-32)(-8,-32)(-8,-34)(-9,-34)(-9,-36)(-10,-36)(-10,-38)(-11,-38)
% (-11,-39)(-12,-39)(-12,-41)(-13,-41)(-13,-42)(-14,-42)(-14,-44)(-15,-44)
% (-15,-45)(-16,-45)(-16,-46)(-17,-46)(-17,-47)(-18,-47)(-18,-48)(-19,-48)
% (-19,-49)(-20,-49)(-20,-50).
makechar(p shiftedright 1/3);
% now the vertical line at the right is flatter;
% notice that the boundary goes from (0,11) to (0,-11):
% (-20,-50)(-20,50)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,46)(-16,46)
% (-16,45)(-15,45)(-15,44)(-14,44)(-14,43)(-13,43)(-13,41)(-12,41)(-12,40)
% (-11,40)(-11,38)(-10,38)(-10,36)(-9,36)(-9,35)(-8,35)(-8,33)(-7,33)
% (-7,31)(-6,31)(-6,28)(-5,28)(-5,26)(-4,26)(-4,23)(-3,23)(-3,20)(-2,20)
% (-2,16)(-1,16)(-1,11)(0,11)(0,-11)(-1,-11)(-1,-16)(-2,-16)(-2,-20)(-3,-20)
% (-3,-23)(-4,-23)(-4,-26)(-5,-26)(-5,-28)(-6,-28)(-6,-31)(-7,-31)(-7,-33)
% (-8,-33)(-8,-35)(-9,-35)(-9,-36)(-10,-36)(-10,-38)(-11,-38)(-11,-40)
% (-12,-40)(-12,-41)(-13,-41)(-13,-43)(-14,-43)(-14,-44)(-15,-44)(-15,-45)
% (-16,-45)(-16,-46)(-17,-46)(-17,-48)(-18,-48)(-18,-49)(-19,-49)(-19,-50).
makechar(p shiftedright .501);
% flatter yet; the rounded curve goes from (0,0) to (1,0) and back to (0,0),
% so you can't actually see it:
% (-19,-50)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,47)(-16,47)(-16,45)
% (-15,45)(-15,44)(-14,44)(-14,43)(-13,43)(-13,41)(-12,41)(-12,40)(-11,40)
% (-11,38)(-10,38)(-10,37)(-9,37)(-9,35)(-8,35)(-8,33)(-7,33)(-7,31)(-6,31)
% (-6,29)(-5,29)(-5,26)(-4,26)(-4,24)(-3,24)(-3,21)(-2,21)(-2,17)(-1,17)
% (-1,12)(0,12)(0,-12)(-1,-12)(-1,-17)(-2,-17)(-2,-21)(-3,-21)(-3,-24)
% (-4,-24)(-4,-26)(-5,-26)(-5,-29)(-6,-29)(-6,-31)(-7,-31)(-7,-33)(-8,-33)
% (-8,-35)(-9,-35)(-9,-37)(-10,-37)(-10,-38)(-11,-38)(-11,-40)(-12,-40)
% (-12,-41)(-13,-41)(-13,-43)(-14,-43)(-14,-44)(-15,-44)(-15,-45)(-16,-45)
% (-16,-47)(-17,-47)(-17,-48)(-18,-48)(-18,-49)(-19,-49)(-19,-50).
makechar(p shiftedright .505);
% at this point the curve has moved right enough to make a "glitch":
% (-19,-50)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,47)(-16,47)(-16,45)
% (-15,45)(-15,44)(-14,44)(-14,43)(-13,43)(-13,41)(-12,41)(-12,40)(-11,40)
% (-11,38)(-10,38)(-10,37)(-9,37)(-9,35)(-8,35)(-8,33)(-7,33)(-7,31)(-6,31)
% (-6,29)(-5,29)(-5,26)(-4,26)(-4,24)(-3,24)(-3,21)(-2,21)(-2,17)(-1,17)
% (-1,12)(0,12)(0,1)(1,1)(1,-1)(0,-1)(0,-12)(-1,-12)(-1,-17)(-2,-17)(-2,-21)
% (-3,-21)(-3,-24)(-4,-24)(-4,-26)(-5,-26)(-5,-29)(-6,-29)(-6,-31)(-7,-31)
% (-7,-33)(-8,-33)(-8,-35)(-9,-35)(-9,-37)(-10,-37)(-10,-38)(-11,-38)
% (-11,-40)(-12,-40)(-12,-41)(-13,-41)(-13,-43)(-14,-43)(-14,-44)(-15,-44)
% (-15,-45)(-16,-45)(-16,-47)(-17,-47)(-17,-48)(-18,-48)(-18,-49)(-19,-49)
% (-19,-50).
path q; q=(-20,-49)..(-20,50) & (-20,50)..(0,0)..(-20,-49) & cycle;
makechar(q shiftedright .5);
% a path of odd length has a glitch even when shifted right 0.5:
% (-19,-49)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,47)(-16,47)(-16,45)
% (-15,45)(-15,44)(-14,44)(-14,43)(-13,43)(-13,42)(-12,42)(-12,40)(-11,40)
% (-11,39)(-10,39)(-10,37)(-9,37)(-9,35)(-8,35)(-8,33)(-7,33)(-7,31)(-6,31)
% (-6,29)(-5,29)(-5,27)(-4,27)(-4,24)(-3,24)(-3,21)(-2,21)(-2,17)(-1,17)
% (-1,12)(0,12)(0,1)(1,1)(1,0)(0,0)(0,-11)(-1,-11)(-1,-16)(-2,-16)(-2,-20)
% (-3,-20)(-3,-23)(-4,-23)(-4,-26)(-5,-26)(-5,-28)(-6,-28)(-6,-30)(-7,-30)
% (-7,-32)(-8,-32)(-8,-34)(-9,-34)(-9,-36)(-10,-36)(-10,-38)(-11,-38)
% (-11,-39)(-12,-39)(-12,-41)(-13,-41)(-13,-42)(-14,-42)(-14,-43)(-15,-43)
% (-15,-44)(-16,-44)(-16,-46)(-17,-46)(-17,-47)(-18,-47)(-18,-48)(-19,-48)
% (-19,-49).
autorounding:=2; smoothing:=1; % ask METAFONT to avoid glitches, if possible
makechar(p); % this one turns out to come out the same
makechar(p shiftedright 1/3);
% the flat spots at the right are now ironed out
% (-20,-50)(-20,50)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,46)(-16,46)
% (-16,45)(-15,45)(-15,44)(-14,44)(-14,43)(-13,43)(-13,41)(-12,41)(-12,40)
% (-11,40)(-11,38)(-10,38)(-10,36)(-9,36)(-9,34)(-8,34)(-8,32)(-7,32)
% (-7,30)(-6,30)(-6,28)(-5,28)(-5,26)(-4,26)(-4,23)(-3,23)(-3,19)(-2,19)
% (-2,15)(-1,15)(-1,9)(0,9)(0,-9)(-1,-9)(-1,-15)(-2,-15)(-2,-19)(-3,-19)
% (-3,-23)(-4,-23)(-4,-26)(-5,-26)(-5,-28)(-6,-28)(-6,-30)(-7,-30)(-7,-32)
% (-8,-32)(-8,-34)(-9,-34)(-9,-36)(-10,-36)(-10,-38)(-11,-38)(-11,-40)
% (-12,-40)(-12,-41)(-13,-41)(-13,-43)(-14,-43)(-14,-44)(-15,-44)(-15,-45)
% (-16,-45)(-16,-46)(-17,-46)(-17,-48)(-18,-48)(-18,-49)(-19,-49)(-19,-50).
makechar(p shiftedright .501);
% (-19,-50)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,47)(-16,47)(-16,45)
% (-15,45)(-15,44)(-14,44)(-14,43)(-13,43)(-13,42)(-12,42)(-12,40)(-11,40)
% (-11,39)(-10,39)(-10,37)(-9,37)(-9,35)(-8,35)(-8,33)(-7,33)(-7,31)(-6,31)
% (-6,29)(-5,29)(-5,27)(-4,27)(-4,25)(-3,25)(-3,22)(-2,22)(-2,18)(-1,18)
% (-1,14)(0,14)(0,8)(1,8)(1,-8)(0,-8)(0,-14)(-1,-14)(-1,-18)(-2,-18)(-2,-22)
% (-3,-22)(-3,-25)(-4,-25)(-4,-27)(-5,-27)(-5,-29)(-6,-29)(-6,-31)(-7,-31)
% (-7,-33)(-8,-33)(-8,-35)(-9,-35)(-9,-37)(-10,-37)(-10,-39)(-11,-39)
% (-11,-40)(-12,-40)(-12,-42)(-13,-42)(-13,-43)(-14,-43)(-14,-44)(-15,-44)
% (-15,-45)(-16,-45)(-16,-47)(-17,-47)(-17,-48)(-18,-48)(-18,-49)(-19,-49)
% (-19,-50).
makechar(p shiftedright .505);
% (the result is identical to the previous case)
makechar(q shiftedright .5);
% (-19,-49)(-19,50)(-19,49)(-18,49)(-18,48)(-17,48)(-17,47)(-16,47)(-16,46)
% (-15,46)(-15,44)(-14,44)(-14,43)(-13,43)(-13,42)(-12,42)(-12,40)(-11,40)
% (-11,39)(-10,39)(-10,37)(-9,37)(-9,35)(-8,35)(-8,34)(-7,34)(-7,32)(-6,32)
% (-6,30)(-5,30)(-5,27)(-4,27)(-4,25)(-3,25)(-3,22)(-2,22)(-2,19)(-1,19)
% (-1,15)(0,15)(0,9)(1,9)(1,-8)(0,-8)(0,-14)(-1,-14)(-1,-18)(-2,-18)(-2,-21)
% (-3,-21)(-3,-24)(-4,-24)(-4,-26)(-5,-26)(-5,-29)(-6,-29)(-6,-31)(-7,-31)
% (-7,-33)(-8,-33)(-8,-34)(-9,-34)(-9,-36)(-10,-36)(-10,-38)(-11,-38)
% (-11,-39)(-12,-39)(-12,-41)(-13,-41)(-13,-42)(-14,-42)(-14,-43)(-15,-43)
% (-15,-45)(-16,-45)(-16,-46)(-17,-46)(-17,-47)(-18,-47)(-18,-48)(-19,-48)
% (-19,-49).
end